home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / qbcmnt11.zip / BOXES.BAS < prev    next >
BASIC Source File  |  1991-02-26  |  17KB  |  308 lines

  1. ' ┌┬──────────────────────────────────────────────────────────────────────┬┐
  2. ' ││ Name     : BOXES                                                     ││
  3. ' ││ Type     : Toolbox                                                   ││
  4. ' ││ Module   : BOXES.BAS                                                 ││
  5. ' ││ Language : MicroSoft QuickBASIC Version 4.5                          ││
  6. ' ││ Source   : LAMCO Software                                            ││
  7. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  8. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  9. ' ││ This Toolbox contains several SubPrograms that draw different kinds  ││
  10. ' ││ of boxes on screen                                                   ││
  11. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  12. ' ┌┬──────────────────────────── REQUIREMENTS ────────────────────────────┬┐
  13. ' ││ CGA                                                                  ││
  14. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  15. ' ┌┬───────────────────────────── .MAK FILE ──────────────────────────────┬┐
  16. ' ││ (not required)                                                       ││
  17. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  18. ' ┌┬────────────────────── COMMAND LINE PARAMETERS ───────────────────────┬┐
  19. ' ││ (none)                                                               ││
  20. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  21. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  22. ' ││ (none)                                                               ││
  23. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  24.  
  25.  
  26. ' Subprograms
  27.   DECLARE SUB DoubleBorderBox (tr%, br%, lc%, rc%)
  28.   DECLARE SUB DoubleBorderFullShadeBox (tr%, br%, lc%, rc%, sc%)
  29.   DECLARE SUB HalfShadeBox (tr%, br%, lc%, rc%, bg%, bc%, sc%)
  30.   DECLARE SUB NoBorderBox (tr%, br%, lc%, rc%)
  31.   DECLARE SUB NoBorderFullShadeBox (tr%, br%, lc%, rc%, sc%)
  32.   DECLARE SUB SingleBorderBox (tr%, br%, lc%, rc%)
  33.   DECLARE SUB SingleBorderFullShadeBox (tr%, br%, lc%, rc%, sc%)
  34.  
  35. ' Beginning of the module level
  36.  
  37.   ' Demonstrate the different boxes drawn by BOXES.BAS
  38.  
  39.   ' Clear screen to black on white with a grey border
  40.     COLOR 8, 7, 8: CLS
  41.  
  42.   ' Draw a box with no border and no shade
  43.     COLOR 15, 1: NoBorderBox 2, 12, 2, 25
  44.     LOCATE 6, 10: PRINT "No border"
  45.     LOCATE 8, 10: PRINT "No shade"
  46.  
  47.   ' Draw a box with a single border but no shade
  48.     SingleBorderBox 2, 12, 28, 52
  49.     LOCATE 6, 34: PRINT "Single border"
  50.     LOCATE 8, 34: PRINT "No shade"
  51.  
  52.   ' Draw a box with a double border but no shade
  53.     DoubleBorderBox 2, 12, 55, 79
  54.     LOCATE 6, 61: PRINT "Double border"
  55.     LOCATE 8, 61: PRINT "No shade"
  56.  
  57.   ' Draw a box with no border but with full shade
  58.     NoBorderFullShadeBox 14, 24, 2, 25, 0
  59.     COLOR 15, 1: LOCATE 18, 8: PRINT "No border"
  60.     LOCATE 20, 8: PRINT "Full shade"
  61.  
  62.   ' Draw a box with a single border and full shade
  63.     SingleBorderFullShadeBox 14, 24, 28, 52, 0
  64.     COLOR 15, 1: LOCATE 18, 33: PRINT "Single border"
  65.     LOCATE 20, 33: PRINT "Full shade"
  66.  
  67.   ' Draw a box with a double border and full shade
  68.     DoubleBorderFullShadeBox 14, 24, 55, 79, 0
  69.     COLOR 15, 1: LOCATE 18, 60: PRINT "Double border"
  70.     LOCATE 20, 60: PRINT "Full shade"
  71.     BEEP: DO: LOOP UNTIL INKEY$ <> ""
  72.  
  73.   ' Draw a box with no border and a half shade
  74.     COLOR 8, 7, 8: CLS
  75.     HalfShadeBox 7, 19, 26, 55, 7, 1, 0
  76.     COLOR 15, 1: LOCATE 12, 35: PRINT "No border"
  77.     LOCATE 14, 35: PRINT "Half shade"
  78.     BEEP: DO: LOOP UNTIL INKEY$ <> ""
  79.  
  80.   ' Clear screen to white on blue with a grey border
  81.     COLOR 15, 1, 8: CLS
  82.  
  83.   ' End of the module level
  84.     END
  85.  
  86. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  87. ' ││ Name : DoubleBorderBox                                               ││
  88. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  89. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  90. ' ││ Draws a box with a double-line border but no shade                   ││
  91. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  92. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  93. ' ││ br% - Bottom row of the box                                          ││
  94. ' ││ lc% - Left column of the box                                         ││
  95. ' ││ rc% - Right column of the box                                        ││
  96. ' ││ tr% - Top row of the box                                             ││
  97. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  98. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  99. ' ││ i%  - Looping index                                                  ││
  100. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  101. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  102. ' ││ DECLARE SUB DoubleBorderBox (tr%, br%, lc%, rc%)                     ││
  103. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  104. SUB DoubleBorderBox (tr%, br%, lc%, rc%) STATIC
  105.  
  106.   LOCATE tr%, lc%: PRINT CHR$(201); STRING$(rc% - lc% - 1, 205); CHR$(187);
  107.   FOR i% = tr% + 1 TO br% - 1
  108.     LOCATE i%, lc%: PRINT CHR$(186); STRING$(rc% - lc% - 1, 32); CHR$(186);
  109.   NEXT i%
  110.   LOCATE br%, lc%: PRINT CHR$(200); STRING$(rc% - lc% - 1, 205); CHR$(188);
  111.  
  112. END SUB
  113.  
  114. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  115. ' ││ Name : DoubleBorderFullShadeBox                                      ││
  116. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  117. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  118. ' ││ Draws a box with a double-line border and a shade that is two        ││
  119. ' ││ characters large and a full line high                                ││
  120. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  121. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  122. ' ││ br% - Bottom row of the box                                          ││
  123. ' ││ lc% - Left column of the box                                         ││
  124. ' ││ rc% - Right column of the box                                        ││
  125. ' ││ sc% - Color code of the shade                                        ││
  126. ' ││ tr% - Top row of the box                                             ││
  127. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  128. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  129. ' ││ i%  - Looping index                                                  ││
  130. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  131. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  132. ' ││ DECLARE SUB DoubleBorderFullShadeBox (tr%, br%, lc%, rc%, sc%)       ││
  133. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  134. SUB DoubleBorderFullShadeBox (tr%, br%, lc%, rc%, sc%) STATIC
  135.  
  136.   LOCATE tr%, lc%: PRINT CHR$(201); STRING$(rc% - lc% - 3, 205); CHR$(187);
  137.   FOR i% = tr% + 1 TO br% - 2
  138.     LOCATE i%, lc%: PRINT CHR$(186); STRING$(rc% - lc% - 3, 32); CHR$(186);
  139.   NEXT i%
  140.   LOCATE br% - 1, lc%
  141.   PRINT CHR$(200); STRING$(rc% - lc% - 3, 205); CHR$(188);
  142.   COLOR , sc%
  143.   FOR i% = tr% + 1 TO br%
  144.     LOCATE i%, rc% - 1: PRINT STRING$(2, 32);
  145.   NEXT i%
  146.   LOCATE br%, lc% + 2: PRINT STRING$(rc% - lc% - 1, 32);
  147.  
  148. END SUB
  149.  
  150. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  151. ' ││ Name : HalfShadeBox                                                  ││
  152. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  153. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  154. ' ││ Draws a box with no border and a shade that is one character large   ││
  155. ' ││ and one half-line high                                               ││
  156. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  157. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  158. ' ││ bc% - Background color of the box                                    ││
  159. ' ││ br% - Bottom row of the box                                          ││
  160. ' ││ bg% - Background color of the screen                                 ││
  161. ' ││ lc% - Left column of the box                                         ││
  162. ' ││ rc% - Right column of the box                                        ││
  163. ' ││ sc% - Color code of the shade                                        ││
  164. ' ││ tr% - Top row of the box                                             ││
  165. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  166. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  167. ' ││ i%  - Looping index                                                  ││
  168. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  169. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  170. ' ││ DECLARE SUB HalfShadeBox (tr%, br%, lc%, rc%, bg%, bc%, sc%)         ││
  171. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  172. SUB HalfShadeBox (tr%, br%, lc%, rc%, bg%, bc%, sc%) STATIC
  173.  
  174.   COLOR bc%: LOCATE tr%, lc%: PRINT STRING$(rc% - lc%, 220);
  175.   FOR i% = tr% + 1 TO br% - 1
  176.     LOCATE i%, lc%: PRINT STRING$(rc% - lc%, 219);
  177.   NEXT i%
  178.   LOCATE br%, lc%: PRINT CHR$(223);
  179.   COLOR , sc%: PRINT STRING$(rc% - lc% - 1, 223);
  180.   FOR i% = tr% + 1 TO br%
  181.     LOCATE i%, rc%: PRINT CHR$(32);
  182.   NEXT i%
  183.  
  184. END SUB
  185.  
  186. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  187. ' ││ Name : NoBorderBox                                                   ││
  188. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  189. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  190. ' ││ Draws a box with no border and no shade                              ││
  191. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  192. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  193. ' ││ br% - Bottom row of the box                                          ││
  194. ' ││ lc% - Left column of the box                                         ││
  195. ' ││ rc% - Right column of the box                                        ││
  196. ' ││ tr% - Top row of the box                                             ││
  197. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  198. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  199. ' ││ i%  - Looping index                                                  ││
  200. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  201. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  202. ' ││ DECLARE SUB NoBorderBox (tr%, br%, lc%, rc%)                         ││
  203. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  204. SUB NoBorderBox (tr%, br%, lc%, rc%) STATIC
  205.  
  206.   FOR i% = tr% TO br%
  207.     LOCATE i%, lc%: PRINT STRING$(rc% - lc% + 1, 32);
  208.   NEXT i%
  209.  
  210. END SUB
  211.  
  212. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  213. ' ││ Name : NoBorderFullShadeBox                                          ││
  214. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  215. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  216. ' ││ Draws a box with no border but a shade that is two characters large  ││
  217. ' ││ and one line high                                                    ││
  218. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  219. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  220. ' ││ br% - Bottom row of the box                                          ││
  221. ' ││ lc% - Left column of the box                                         ││
  222. ' ││ rc% - Right column of the box                                        ││
  223. ' ││ sc% - Color code of the shade                                        ││
  224. ' ││ tr% - Top row of the box                                             ││
  225. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  226. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  227. ' ││ i%  - Looping index                                                  ││
  228. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  229. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  230. ' ││ DECLARE SUB NoBorderFullShadeBox (tr%, br%, lc%, rc%, sc%)           ││
  231. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  232. SUB NoBorderFullShadeBox (tr%, br%, lc%, rc%, sc%) STATIC
  233.  
  234.   FOR i% = tr% TO br% - 1
  235.     LOCATE i%, lc%: PRINT STRING$(rc% - lc% - 1, 32);
  236.   NEXT i%
  237.   COLOR , sc%
  238.   FOR i% = tr% + 1 TO br%
  239.     LOCATE i%, rc% - 1: PRINT STRING$(2, 32);
  240.   NEXT i%
  241.   LOCATE br%, lc% + 2: PRINT STRING$(rc% - lc% - 1, 32);
  242.  
  243. END SUB
  244.  
  245. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  246. ' ││ Name : SingleBorderBox                                               ││
  247. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  248. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  249. ' ││ Draws a box with a single border line but no shade                   ││
  250. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  251. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  252. ' ││ br% - Bottom row of the box                                          ││
  253. ' ││ lc% - Left column of the box                                         ││
  254. ' ││ rc% - Right column of the box                                        ││
  255. ' ││ tr% - Top row of the box                                             ││
  256. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  257. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  258. ' ││ i%  - Looping index                                                  ││
  259. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  260. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  261. ' ││ DECLARE SUB SingleBorderBox (tr%, br%, lc%, rc%)                     ││
  262. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  263. SUB SingleBorderBox (tr%, br%, lc%, rc%) STATIC
  264.  
  265.   LOCATE tr%, lc%: PRINT CHR$(218); STRING$(rc% - lc% - 1, 196); CHR$(191);
  266.   FOR i% = tr% + 1 TO br% - 1
  267.     LOCATE i%, lc%: PRINT CHR$(179); STRING$(rc% - lc% - 1, 32); CHR$(179);
  268.   NEXT i%
  269.   LOCATE br%, lc%: PRINT CHR$(192); STRING$(rc% - lc% - 1, 196); CHR$(217);
  270.  
  271. END SUB
  272.  
  273. ' ┌┬───────────────────────────── SUBPROGRAM ─────────────────────────────┬┐
  274. ' ││ Name : SingleBorderFullShadeBox                                      ││
  275. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  276. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  277. ' ││ Draws a box with a single border line and a full shade               ││
  278. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  279. ' ┌┬───────────────────────────── PARAMETERS ─────────────────────────────┬┐
  280. ' ││ br% - Bottom row of the box                                          ││
  281. ' ││ lc% - Left column of the box                                         ││
  282. ' ││ rc% - Right column of the box                                        ││
  283. ' ││ sc% - Color code of the shade                                        ││
  284. ' ││ tr% - Top row of the box                                             ││
  285. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  286. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  287. ' ││ i%  - Looping index                                                  ││
  288. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  289. ' ┌┬───────────────────── MODULE LEVEL DECLARATIONS ──────────────────────┬┐
  290. ' ││ DECLARE SUB SingleBorderFullShadeBox (tr%, br%, lc%, rc%, sc%)       ││
  291. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  292. SUB SingleBorderFullShadeBox (tr%, br%, lc%, rc%, sc%) STATIC
  293.  
  294.   LOCATE tr%, lc%: PRINT CHR$(218); STRING$(rc% - lc% - 3, 196); CHR$(191);
  295.   FOR i% = tr% + 1 TO br% - 2
  296.     LOCATE i%, lc%: PRINT CHR$(179); STRING$(rc% - lc% - 3, 32); CHR$(179);
  297.   NEXT i%
  298.   LOCATE br% - 1, lc%
  299.   PRINT CHR$(192); STRING$(rc% - lc% - 3, 196); CHR$(217);
  300.   COLOR , sc%
  301.   FOR i% = tr% + 1 TO br%
  302.     LOCATE i%, rc% - 1: PRINT STRING$(2, 32);
  303.   NEXT i%
  304.   LOCATE br%, lc% + 2: PRINT STRING$(rc% - lc% - 1, 32);
  305.  
  306. END SUB
  307.  
  308.